﻿using System.Collections.Generic;

namespace DevOnServer
{
    public class CJobProp
    {
        public byte ID;

        public float AttackSpeed;

        public float FactorMaxHP;

        public float FactorMaxMP;

        public float FactorMaxFP;

        public float FactorDef;

        public float FactorHPRecovery;

        public float FactorMPRecovery;

        public float FactorFPRecovery;

        public float MeleeSWD;

        public float MeleeAXE;

        public float MeleeSTAFF;

        public float MeleeSTICK;

        public float MeleeKNUCKLE;

        public float MagicWAND;

        public float Blocking;

        public float MeleeYOYO;

        public float Critical;
    }

    public partial class CDataManager
    {
        public Dictionary<byte, CJobProp> JobProperties = new Dictionary<byte, CJobProp>();

        private bool _loadPropJob(string filename)
        {
            CFileReader file = new CFileReader();
            if (!file.load(filename))
            {
                CConsole.WriteLine("Can't open job prop file '{0}'", filename);
                return false;
            }

            CJobProp prop;

            string tok;
            while (!file.end)
            {
                tok = file.getString();
                if (!m_defines.ContainsKey(tok))
                    continue;

                prop = new CJobProp();

                prop.ID = (byte)m_defines[tok];

                prop.AttackSpeed = file.getFloat();

                prop.FactorMaxHP = file.getFloat();

                prop.FactorMaxMP = file.getFloat();

                prop.FactorMaxFP = file.getFloat();

                prop.FactorDef = file.getFloat();

                prop.FactorHPRecovery = file.getFloat();

                prop.FactorMPRecovery = file.getFloat();

                prop.FactorFPRecovery = file.getFloat();

                prop.MeleeSWD = file.getFloat();

                prop.MeleeAXE = file.getFloat();

                prop.MeleeSTAFF = file.getFloat();

                prop.MeleeSTICK = file.getFloat();

                prop.MeleeKNUCKLE = file.getFloat();

                prop.MagicWAND = file.getFloat();

                prop.Blocking = file.getFloat();

                prop.MeleeYOYO = file.getFloat();

                prop.Critical = file.getFloat();

                JobProperties[prop.ID] = prop;
            }

            return true;
        }
    }
}